package com.ruitu.ssmic.ui;

import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.ruitu.arad.base.BaseFragment;
import com.ruitu.arad.util.ToastUtils;
import com.ruitu.ssmic.R;

public class Test1Fragment extends BaseFragment {
    private TextView tv_alert;//点击弹窗

    public static Test1Fragment newInstance() {

        Bundle args = new Bundle();

        Test1Fragment fragment = new Test1Fragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_test1, container, false);
        tv_alert = v.findViewById(R.id.tv_alert);

        tv_alert.setOnClickListener(this);

        return v;
    }

    @Override
    public void onClick(View v) {
        if (v == tv_alert) {
            hideProgress();
            showProgress();
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    hideProgress();
                    showReqResultDialog();
                }
            }, 1000);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    protected void onAlertHandle() {
        ToastUtils.showShortSafe("Fragment处理点击左键");
    }

    @Override
    protected void onAlertCancel() {
//        super.onAlertCancel();
        ToastUtils.showShortSafe("Fragment处理点击右键");
    }
}
